<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>个人中心</title>
    <link rel="stylesheet" th:href="@{/static/layui/js/css/layui.css}">
    <script th:src="@{/static/layui/js/layui.js}" charset="UTF-8" type="text/javascript"></script>
    <script th:src="@{/static/vue/vue.js}" charset="UTF-8" type="text/javascript"></script>
    <script th:src="@{/static/vue/axios.min.js}" charset="UTF-8" type="text/javascript"></script>
    <script th:src="@{/static/jquery/jquery.js}" charset="UTF-8" type="text/javascript"></script>
    <style>
        .layui-bold{
            font-weight: bold;
        }
    </style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header layui-bg-green">
        <div class="layui-logo layui-hide-xs  layui-bg-green layui-bold">个人中心</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-bg-green layui-layout-right" style="height: 59px">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" class="layui-nav-img" id="userPortrait">
                    我

                    <script th:inline="javascript">
                        let bufferedPortrait = [[${stp.getSession().getString('userPortraitCode')}]]
                        if(bufferedPortrait !== ''){
                            $('#userPortrait').attr('src',"data:image/png;base64,"+bufferedPortrait)
                        }else{
                            $('#userPortrait').attr('src',"//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg")
                        }

                    </script>
                </a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/community/personal}">个人中心</a></dd>
                    <dd><a href="" class="logout">退出登录</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-green">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-bg-green layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-bg-green layui-nav-itemed">
                    <a class="layui-nav-itemed" >个人信息</a>
                    <dl class="layui-nav-child">
                        <dd >

                            <a  style="margin-left: 20px;width: 80%;" th:href="@{/community/personal}">
                                <span style="color: white">个人资料</span>
                                <span class="layui-icon">&#xe715;</span>
                            </a>

                        </dd>
                        <dd><a style="margin-left: 20px;width: 80%" th:href="@{/community/personal/security}">账号安全</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a th:href="@{'/community/personal/space/'+${stp.getLoginId()}}">个人空间</a></li>
                <li class="layui-nav-item"><a th:href="@{/community/personal/private_spaces}">私人空间</a></li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div class="layui-row">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                <legend>头像上传</legend>
            </fieldset>

            <div class="layui-row" style="margin-left: 20px">
                <div class="layui-upload">
                    <div class="layui-btn-group">
                        <button type="button" class="layui-btn layui-btn-sm" id="img_choose_click">
                            <i class="layui-icon">&#xe654;</i>
                        </button>
                        <button type="button" class="layui-btn layui-btn-sm" id="img_upload_click">
                            <i class="layui-icon">&#xe67c;</i>
                        </button>
                        <button type="button" class="layui-btn layui-btn-sm layui-btn-warm" id="img_reset_click">
                            <i class="layui-icon">&#x1006;</i>
                        </button>
                    </div>

                    <!--预览框-->
                    <div class="layui-upload-list">
                        <img class="layui-upload-img " id="img" style="width: 125px;height: 120px">
                        <p id="demoText"></p>
                    </div>
                    <!--进度条-->
                    <div style="width: 125px;">
                        <div class="layui-progress layui-progress-big" lay-showpercent="yes" lay-filter="progress">
                            <div class="layui-progress-bar" lay-percent=""></div>
                        </div>
                    </div>
                </div>
            </div>

        </div>


        <div class="layui-row">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                <legend>其他个人信息</legend>
            </fieldset>

            <div class="layui-row" style="margin-left: 20px">
                <form class="layui-form layui-form-pane" action="" >
                    <div class="layui-form-item">
                        <label class="layui-form-label">用户id号</label>
<!--                        <label class="layui-form-label" style="width: 190px" th:inline="text">[[${stp.getLoginId()}]]</label>-->
                        <div class="layui-input-inline">
                            <input type="text"
                                   lay-verify="required"
                                   autocomplete="off"
                                   class="layui-input"
                                   id="showUserId"
                                   style="background-color: whitesmoke"
                                   disabled = "disabled"


                            >
                            <!--信息回显脚本-->
                            <script th:inline="javascript">
                                let showUserId = [[${stp.getLoginId()}]]
                                $('#showUserId').val(showUserId)

                            </script>
                        </div>

                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">昵称</label>
                        <div class="layui-input-inline">

                            <!--显示昵称-->
                         <input type="text"
                                lay-verify="required"
                                autocomplete="off"
                                class="layui-input"
                                id="setUsername"
                         >
                            <!--信息回显脚本-->
                            <script th:inline="javascript">
                                let username = [[${stp.getSession().getString('username')}]]
                                $('#setUsername').val(username)

                            </script>


                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">生日选择</label>
                            <div class="layui-input-block">
                                <input type="text" name="date" id="date1" autocomplete="off" class="layui-input">
                                <!--信息回显脚本-->
                                <script th:inline="javascript">
                                    let birthday = [[${stp.getSession().getString('birthday')}]]
                                    $('#date1').val(birthday)

                                </script>
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">邮箱</label>
                        <div class="layui-input-inline">
                            <input type="text"  lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" id="email">
                            <!--信息回显脚本-->
                            <script th:inline="javascript">
                                let email = [[${stp.getSession().getString('email')}]]
                                $('#email').val(email)

                            </script>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text" style="width: 500px">
                        <label class="layui-form-label">签名
                            <span style="margin-left: 65%;display: none" id="textNumTip" >
                                <a style="color: gray;font-size: xx-small" >
                                    还可以再输入:
                                </a>
                                <a id="textNum" style="color: red; font-size: xx-small">0</a>
                                <a style="color: gray;font-size: xx-small">字</a>


                            </span>

                        </label>
                        <div class="layui-input-block">
                            <textarea placeholder="请输入内容" class="layui-textarea" id="sign" ></textarea>
                            <!--信息回显脚本-->
                            <script th:inline="javascript">
                                let sign = [[${stp.getSession().getString('sign')}]]
                                $('#sign').val(sign)

                            </script>
                        </div>
                    </div>
                    <div class="layui-form-item" id="submitForm">
                        <button class="layui-btn" @click="submit">提交</button>
                    </div>
                </form>
            </div>

        </div>


    </div>

</div>

<script th:src="@{/static/personal-main.js}"></script>
<script>
    //JS
    layui.use(['element', 'layer', 'util'], function(){
        var element = layui.element
            ,layer = layui.layer
            ,util = layui.util
            ,$ = layui.$;

        //头部事件
        util.event('lay-header-event', {
            //左侧菜单事件
            menuLeft: function(othis){
                layer.msg('展开左侧菜单的操作', {icon: 0});
            }
            ,menuRight: function(){
                layer.open({
                    type: 1
                    ,content: '<div style="padding: 15px;">处理右侧面板的操作</div>'
                    ,area: ['260px', '100%']
                    ,offset: 'rt' //右上角
                    ,anim: 5
                    ,shadeClose: true
                });
            }
        });

    });
</script>
<!--退出登录操作的url-->
<form th:action="@{/logout}" class="logout-url"></form>
<form th:action="@{/login}" class="login-page"></form>
<script th:src="@{/static/logout.js}"></script>

<!--头像上传的接口-->
<form th:action="@{'/community/personal/picture/portrait/'+${stp.getLoginId()}}" id="portraitUpload"></form>
<!--用户资料上传的接口-->
<form th:action="@{/community/personal/userInfo}" id="userInfoUpload"></form>


</body>
</html>
